package com.etc.zzsys.service.impl;

import java.util.List;

import com.etc.zzsys.dao.UsersDao;
import com.etc.zzsys.dao.impl.UsersDaoImpl;
import com.etc.zzsys.entiy.Users;
import com.etc.zzsys.service.UsersService;
import com.etc.zzsys.util.MD5Util;

/**
 * UsersService的实现类
 * 
 * @author knowno
 *
 */
public class UsersServiceImpl implements UsersService {

	/**
	 * 调用usersDao的方法
	 */
	private UsersDao ud = new UsersDaoImpl();

	@Override
	public List<Users> getUsers() {
		// TODO Auto-generated method stub
		return ud.queryUsers();
	}

	@Override
	public boolean addUsers(Users u) {
		// TODO Auto-generated method stub
		return ud.addUsers(u);
	}

	@Override
	public boolean delUsers(int userId) {
		// TODO Auto-generated method stub
		return ud.delUsers(userId);
	}

	@Override
	public boolean updateUsers(Users u) {
		// TODO Auto-generated method stub
		return ud.updateUsers(u);
	}

	@Override
	public Users login(String userName, String userPwd) {
		// TODO Auto-generated method stub
		// 调用ud的方法时候，密码要先加密传递过去
		userPwd = MD5Util.getEncodeByMd5(userPwd);
		return ud.queryByNameAndPwd(userName, userPwd);
	}

}
